package com.xbongbong.paas.service;

import com.xbongbong.paas.pojo.IdNamePojo;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetCheckDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetDeleteDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetDetailDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetEditDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetEnableDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetInitDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetListByPermissionDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetListDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetPermissionListDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetProductListDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetSaveDTO;
import com.xbongbong.pro.performanceset.pojo.dto.PerformanceSetSaveGuideDTO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetCheckVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetDeleteVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetDetailVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetEditVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetEnableVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetInitVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetListByPermissionVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetListVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetPermissionListVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetSaveGuideVO;
import com.xbongbong.pro.performanceset.pojo.vo.PerformanceSetSaveVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.sys.domain.entity.UserEntity;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @description: 业绩目标指标
 * @Author: hongxiao
 * @date: 2019-01-25 14:21
 * @since v1.0
 */
public interface PerformanceSetService {
    /**
     * 业绩目标指标引导第一步
     * @param performanceSetInitDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-01-31 16:53
     * @since v1.0
     * @version v.10
     */
    PerformanceSetInitVO init(PerformanceSetInitDTO performanceSetInitDTO) throws XbbException;

    /**
     * 引导页（一次性保存多项设置）
     * @param saveGuideDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-01-30 14:45
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetSaveGuideVO saveGuide(PerformanceSetSaveGuideDTO saveGuideDTO) throws XbbException;

    /**
     * 业绩目标指标列表
     * @param performanceSetListDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-01-30 20:16
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetListVO list(PerformanceSetListDTO performanceSetListDTO) throws XbbException;

    /**
     * 业绩目标指标详情
     * @param performanceSetDetailDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-01-31 14:12
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetDetailVO detail(PerformanceSetDetailDTO performanceSetDetailDTO) throws XbbException;

    /**
     * 编辑业绩目标指标
     * @param performanceSetEditDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-01-31 19:11
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetEditVO edit(PerformanceSetEditDTO performanceSetEditDTO) throws XbbException;

    /**
     * 保存业绩目标指标
     * @param performanceSetSaveDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-01 09:10
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetSaveVO save(PerformanceSetSaveDTO performanceSetSaveDTO) throws XbbException;

    /**
     * 删除业绩目标指标
     * @param performanceSetDeleteDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-01 14:47
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetDeleteVO delete(PerformanceSetDeleteDTO performanceSetDeleteDTO) throws XbbException;

    /**
     * 启用业绩目标指标
     * @param performanceSetEnableDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-01 14:47
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetEnableVO enable(PerformanceSetEnableDTO performanceSetEnableDTO) throws XbbException;

    /**
     * 业绩目标指标是否已配置
     * @param performanceSetCheckDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-15 09:24
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetCheckVO check(PerformanceSetCheckDTO performanceSetCheckDTO) throws XbbException;

    /**
     * 获取登录员工能看到的指标列表
     * @param performanceSetListByPermissionDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-15 14:00
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetListByPermissionVO listByPermission(PerformanceSetListByPermissionDTO performanceSetListByPermissionDTO) throws XbbException;

    /**
     * 获取考核对象[员工/部门]列表
     * @param performanceSetPermissionListDTO 入参
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-15 21:05
     * @since v1.0
     * @version v1.0
     */
    PerformanceSetPermissionListVO permissionList(PerformanceSetPermissionListDTO performanceSetPermissionListDTO) throws XbbException;

    /**
     * 获取考核的员工id列表，并与自己的下属ids取交集
     * @param userEntity 员工
     * @param setId 指标id
     * @param permissionList 考核对象列表
     * @param nameDepMap 部门名称map
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-19 13:53
     * @since v1.0
     * @version v1.0
     */
    Set<String> getPermission2UserIdsRetainSub(UserEntity userEntity, Long setId, List<IdNamePojo> permissionList,
                                                      Map<Long, String> nameDepMap);
    /**
     * 获取考核对象内所有的部门id列表，并与自己主管的部门ids取交集
     * @param userEntity 员工
     * @param setId 指标id
     * @param permissionList 考核对象
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-19 14:26
     * @since v1.0
     * @version v1.0
     */
    List<Long> getPermission2DepIdsRetainSub(UserEntity userEntity, Long setId, List<IdNamePojo> permissionList);

    /**
     * 获取员工所在的部门名称
     * @param nameDepMap 部门id--部门名称
     * @param entity 员工实体
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-22 16:21
     * @since v1.0
     * @version v1.0
     */
    String getDepNames4User(Map<Long, String> nameDepMap, UserEntity entity);

    /**
     * 获取考核产品
     * @param performanceSetProductListDTO
     * @return
     */
    PerformanceSetPermissionListVO productList(PerformanceSetProductListDTO performanceSetProductListDTO) throws XbbException;

    /**
     * 获取考核的员工id列表，并与自己的下属ids取交集
     * @return
     * @throws
     *
     * @author hongxiao
     * @date: 2019-02-19 13:53
     * @since v1.0
     * @version v1.0
     */
    Set<String> getPermission2UserIdsRetainSub(UserEntity userEntity);
}
